package com.jsmtr.rms.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jsmtr.rms.dao.DaoService;
import com.jsmtr.rms.entity.*;
import com.jsmtr.rms.service.IBaseEvaluationService;

@Service
public class BaseEvaluationService implements IBaseEvaluationService {

    @Resource
    private DaoService dao;

    public void setDao(DaoService dao) {
        this.dao = dao;
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<BaseEvaluationTable> getTables() throws Exception {
        return dao.find("from BaseEvaluationTable");
    }

    @Override
    public BaseEvaluationTable getTable(String id) throws Exception {
        return (BaseEvaluationTable) dao.findUnique("from BaseEvaluationTable where id='" + id + "'");
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<BaseEvaluationItem> getBaseEvaluationItems(String tid) throws Exception {
        return dao.find("from BaseEvaluationItem where tid='" + tid + "'");
    }
}
